import axios from 'axios';

const API_URL = 'http://localhost:8080/student';

// 获取所有学生
export const getAllStudents = () => {
  return axios.get(API_URL);
};

// 添加学生
export const addStudent = (studentData) => {
  return axios.post(API_URL, studentData);
};

// 根据 ID 删除学生
export const deleteStudentById = (id) => {
  return axios.delete(`${API_URL}/${id}`);
};

// 根据 ID 获取学生信息
export const getStudentById = (id) => {
  return axios.get(`${API_URL}/${id}`);
};

// 更新学生信息
export const updateStudent = (id, studentData) => {
  return axios.put(`${API_URL}/${id}`, studentData);
};
